#ifndef __SHAREDSEG_H
#define __SHAREDSEG_H
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/sem.h>
#include <stdlib.h>
#include <stdio.h>
#ifndef DTP
#define DTP 50		// Datas per Batch
#endif

#define MAX_PARAM_SIZE 512
#define MAX_COMMAND_SIZE 64
#define MAX_RESULT_SIZE 64

struct shared {
	bool abort;
	char command[MAX_COMMAND_SIZE];
	char param1[MAX_PARAM_SIZE];
	char param2[MAX_PARAM_SIZE];
	char result[MAX_RESULT_SIZE];
	bool moredata;
	char data[DTP][MAX_PARAM_SIZE];
};
#define SEGSIZE sizeof(struct shared)
#define TEXT "/tagger"
#define CHAR 'D'
#define SEMKEY1 ftok(TEXT,'c')
#define SEMKEY2 ftok(TEXT,'s')

extern struct sembuf sem[3];
extern struct shared *segptr;
extern int shmid;
extern int semid;
extern short sarray[3];
extern int client_sem,server_sem;
extern int anyclient;
void sem_signal(int which);
void sem_wait(int which);
#endif
